package com.zy.sort;

import java.util.Arrays;

/**
 * @Author Gong
 * @Description
 * @dATE 2021/11/29 21:57
 **/
public class BubbleSort {
    public static void main(String[] args) {
        int[] arr = {64, 34, 25, 12, 22, 11, 90,-1,-2};
        for (int j = 0; j < arr.length -1; j++) {
            for (int i = 0; i < arr.length - j -  1 ; i++){
                if(arr[i] > arr[i+1]){
                    int temp = arr[i];
                    arr[i] = arr[i +1];
                    arr[i+1] = temp;
                }
            }
        }
        System.out.println(Arrays.toString(arr));
    }
}
